package com.sushi.controller;

import com.sushi.service.MessageService;
import com.sushi.response.ResponseBO;
import com.sushi.response.ResponsePageBO;
import com.sushi.response.MessageResp;
import com.sushi.request.MessageReq;
import com.sushi.request.MessagePageReq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.*;

/**
 * 消息 控制器
 * @date 2023-05-02
 * @time 17:15:12
 * @author Administrator
 */
@RestController
@Slf4j
public class MessageController {

	@Autowired
	private MessageService messageService;

    

    /**
     * 新增
     */
    @PostMapping("/message/add")
    public ResponseBO<MessageResp> add(@RequestBody MessageReq req) {
        return messageService.add(req);
    }

    /**
     * 逻辑删除
     */
    @PostMapping("/message/remove")
    public ResponseBO<MessageResp> remove(@RequestBody MessageReq req) {
        return messageService.logicRemove(req);
    }

    /**
     * 更新
     */
    @PostMapping("/message/update")
    public ResponseBO<MessageResp> update(@RequestBody MessageReq req) {
        return messageService.updateByField(req);
    }

    /**
     * 列表
     */
    @PostMapping("/message/list")
    public ResponsePageBO<MessageResp> list(@RequestBody MessagePageReq req) {
        return messageService.listByCondition(req);
    }

    /**
     * 详情
     */
    @PostMapping("/message/detail")
    public ResponseBO<MessageResp> detail(@RequestBody MessageReq req) {
        return messageService.detail(req);
    };

}